from selenium import webdriver
import time
from selenium.webdriver.common.by import By

driver = webdriver.Chrome(r'D:\bianchengerbianchenger\driver\chromedriver.exe')
driver.get('https://movie.douban.com/top250')
driver.maximize_window()
time.sleep(1)
all_message = driver.find_elements(By.CSS_SELECTOR,'div.hd')
time.sleep(1)


for i in all_message:
    video_name = i.find_element(By.CSS_SELECTOR,'span.title').text
    Director_and_Mainactor = i.find_element(By.XPATH,'/html/body/div[3]/div[1]/div/div[1]/ol/li[1]/div/div[2]/div[2]/p[1]').text
    # Director_and_Mainactor = i.find_element(By.CSS_SELECTOR,'div.bd p ').text
    # print(type(Director_and_Mainactor))

    # print(Director_and_Mainactor.split(sep='/',maxsplit=4))
    a=Director_and_Mainactor.split()



    # director = i.find_element(By.CSS_SELECTOR,'span.title').text
    # main_actor = i.find_element(By.CSS_SELECTOR,'span.title').text
    # date = i.find_element(By.CSS_SELECTOR,'span.title').text
    # country = i.find_element(By.CSS_SELECTOR,'span.title').text
    # type_of_movie = i.find_element(By.CSS_SELECTOR,'span.title').text
    # score = i.find_element(By.CSS_SELECTOR,'span.title').text
    # remark_or_comment = i.find_element(By.CSS_SELECTOR,'span.title').text
    # describe_noun_description = i.find_element(By.CSS_SELECTOR,'span.title').text


    # print("电影名称：{}\n导演：{}".format(video_name,Director_and_Maincator))

    # print("电影名称：{}\n导演：{}\n主演：{}\n年份：{}\n国家：{}\n类型：{}\n评分：{}\n评论数量：{}\n描述:{}\n".format(video_name))
